/**
 * @Name : index
 * @Description : 测试哈希表
 * @Author : yi
 * @Date : 2022/3/30
 **/

import {hashFn,HashTable} from "./hashTable";

// ----------------- 哈希表结构测试 -----------------//
alert("哈希表结构测试");

alert("哈希函数测试");
alert(hashFn("123"));
alert(hashFn("abc"));

const hashTable = new HashTable();

// put() 测试
alert("put() 测试");
hashTable.put( "name", "XPoet");
hashTable.put("age", 18);
hashTable.put( "height", 178);
hashTable.put( "email", "i@XPoet");
hashTable.put( "address", "china");
alert(hashTable);
console.log(hashTable);

hashTable.put( "address2", "china2");

alert(hashTable);
console.log(hashTable);


// get() 测试
alert("get() 测试");
alert(hashTable.get("name"));

// remove() 测试
alert("remove() 测试");
hashTable.remove("address");
alert(hashTable);
console.log(hashTable);


// isEmpty() 测试
alert("isEmpty() 测试");
alert(hashTable.isEmpty());

// size() 测试
alert("size() 测试");
alert(hashTable.size());

alert("哈希表测试结束");
